	/* 
	 * JTable empleados
	 */
	$(document).ready(function() {  
		

	     /* $(function() {
	    		$('.jtable').on('click', ':checkbox', function() {
	    			var $selectedRows = $(this).closest('tr');
	    			
	    			var $Usersid="";

	    			if ($('.jtable :checked').length == 0) {
	    				   if ($selectedRows.data('record')==undefined){
	    					   alert("desactivados todos lo checkbox");
	    					   $Usersid="";
	    				   }
	 	            	   alert($selectedRows.data('record').Userid + "nochecked");
	    			}
	    			else {
    				   if ($selectedRows.data('record')==undefined){
    					   alert("activados todos lo checkbox");
    					   JSONArray jArray = new JSONArray();
    					   while($selectedRows.hasNext()){
    					     int objId = itr.next();
    					     jArray.put(objId, odao.getObjectName(objId));
    					   }
    					 results = jArray.toString();
    					   
    				   }
 	            	   alert($selectedRows.data('record').Userid + "Checked" );
	    			}
	    		});
	    		
	    		
	    		$.post("/myurlpath/refreshTable", "usersid="+$usersid,
	    			       function(results)
	    			       {
	    			           $('#MyTableDiv').jtable('reload');
	    			       }
	    			       , "json");
	    		
	    	});
	      
	      
	      /*$("#mytable").on("click", ".buttonvalues", function() {
	    	     var options = $(this).closest('tr')
	    	                          .find('input[type=checkbox]:checked')
	    	                          .map(function() {
	    	                              return $.trim( $(this).parent().text() );
	    	                          }).get();
	    	});*/
	      
	      
	    //setup the jtable that will display the results
	    $('#TablaDecomparticionDeInformes').jtable({
	        title: ' ',
	        selecting: false, //Enable selecting 
	        paging: false, //Enable paging
	        pageSize: 10, //Set page size (default: 10)
	        sorting: false, //Enable sorting
            defaultSorting: 'Nombre ASC', //Set default sorting
            //selecting: true, //Enable selecting
            //multiselect: true, 
            //selectingCheckboxes: true,
	        actions: {
	        	listAction: 'getCompartidas',
	        	updateAction: 'updatecompartidas',
	        },
	        fields: {
	        	Id: {
	                key:true,
	                visibility: 'hidden'
	            },
	        	Userid: {
	                key:true,
	                visibility: 'hidden'
	            },
	            Compartir: {
	            	title: '',
                    type: 'checkBox',
                    create: false,
                    edit: false,
                    sorting: false,
                    list: true,
                    display: function(data){
                    	if (data.record.Compartidas==false){
                    		return '<img src="/plantilla/images/tick_inactivo.png" width="32" height="32" class="preview">';
                    	}else{
                    		return '<img src="/plantilla/images/tick_activo.png" width="32" height="32" class="preview">';
                    	}
                    },
                    width: "10%",
                    listClass: "class-row-center"

	            },
	            Compartidas:{
	            	title: "Compartir informes",
	            	type:"checkbox",
	            	edit:true,
	            	list:false,
                    values: { 'false': '', 'true': '' }
	            },
	            
	            Nombre: {
	            	width: '90%',
	                sorting: false,
	                edit:true,
	                input: function (data) {
	                    if (data.value) {
	                    	return '<input type="textarea" Style="border:none" readonly class="jtable-input-readonly" name="Nombre" value="' + data.value + '"/>';
	                  	}
	                },
	                list: true
	            },
	            Tipo:{
	            	key:true,
	            	list:false
	            }
	            
	        },
	        
	      //Initialize validation logic when a form is created
            formCreated: function (event, data) {
                data.form.validationEngine();
            },
            //Validate form when it is being submitted
            formSubmitting: function (event, data) {
                return data.form.validationEngine('validate');
            },
            //Dispose validation logic when form is closed
            formClosed: function (event, data) {
                data.form.validationEngine('hide');
                data.form.validationEngine('detach');
            },
	        //Register to selectionChanged event to hanlde events                                     
	        recordAdded: function(event, data){
	            //after record insertion, reload the records
	            $('#TablaDecomparticionDeInformes').jtable('load');
	        },
	        recordUpdated: function(event, data){
	            //after record updation, reload the records
	            $('#TablaDecomparticionDeInformes').jtable('load');
	        },
	        selectionChanged: function () {
                //Get all selected rows
                var $selectedRows = $('#StudentTableContainer').jtable('selectedRows');
 
                $('#SelectedRowList').empty();
                if ($selectedRows.length > 0) {
                    //Show selected rows
                    $selectedRows.each(function () {
                        var record = $(this).data('record');
                        $('#SelectedRowList').append(
                            '<b>StudentId</b>: ' + record.StudentId +
                            '<br /><b>Name</b>:' + record.Name + '<br /><br />'
                            );
                    });
                } else {
                    //No rows selected
                    $('#SelectedRowList').append('No row selected! Select rows to see here...');
                }
            },
	    });
	    $('#TablaDecomparticionDeInformes').jtable('load');              
	                
	});